
CODE README FILE:  MPEC_SPLINE_STATES (Piecewise Linear Specification)

This file provides information about the the code release which accompanies "BORDERS, GEOGRAPHY AND OLIGOPOLY: EVIDENCE FROM THE WIND TURBINE INDUSTRY" by Kerem Cosar, Paul Grieco, and Felix Tintelnot.

The primary code was run uses MATLAB version 2012b and KNITRO 8.1.1 and 8.2. It has been run successfully on a Mac Pro OSX version 8.10.5 and on the Lion-XF cluster at Pennsylvania State University (https://rcc.its.psu.edu/resources/hpc/lionxf/#specs).  The bootstrap computation is parallelized and makes use of the PBS batch system on the Lion-XF cluster. 

What follows is a description of the files in this directory, which estimates the piecewise linear specification. Note this directory simply uses data_structures from 
earlier specifications.  

The specification can be run by running "Main_mpec" at the MATLAB prompt with KNITRO properly installed. 

CODE FILES: 
Code files are listed in order in which they are called: 


Main_mpec.m - Constructs sparsity pattern, calls optimization, and computes standard errors for the primary estimation. Saves results in 'est_results_rad_states_cgt.mat'

dummy_objective.m - A dummy function which returns zero.  Used when we want to simply
solve for equilibrium instead of optimize the likelihood.  It is used as an objective
function input to KNITRO where the equilibrium constraints are supplied as constraints. 

model_constraints.m - Contains a function to compute the equilibrium constraints of the model. Used by KNITRO in optimization and also in solving for equilibrium. Also supplies
the gradient of the constraints. 

eqm_constraints.m -  Contains a function to compute the equilibrium constraints of the model. Used by KNITRO in optimization and also in solving for equilibrium. Also supplies
the gradient of the constraints. The only difference between it and model_constraints is that the parameter vector is not included as part of the input vector. 

likelihood_func.m - Contains a function to compute the model likelihood. Used as objective function by KNITRO in estimation. 

knitro.opt - KNITRO options file. 

INPUT FILES:
data_structures.mat (PROPRIETARY) - Contains the structures used as inputs to the estimation. 

stateDumSorted.csv (PROPRIETARY) - Contains state of origin information for each project. 

dist_matrix_data.mat (PROPRIETARY) - Inter-project distance matrixes for use in the moran test. 

OUTPUT FILES: 

est_results_rad_states_cgt.mat - Results from the estimation are stored here. 



